#include <thread>
#include "config.hpp"
#include "http.hpp"
#include "camera.hpp"
#include "mainWindow.hpp"

/** 全局变量 */
bool running = true; // 运行标志，控制进程是否运行
bool suspend = true; // 暂停标志，控制进程是否暂停
// 帧缓冲区
vector<Mat> all_frames;
// 帧互斥锁
mutex frame_mutex;
// 视频上传完成标志，默认视频上传完成
bool video_uploaded = true;


int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    MainWindow window;
    window.show();

    thread camera_thread(camera_get, &window);
    thread http_image_thread(http_post_image);
    thread http_video_thread(http_post_video);

    app.exec();

    camera_thread.join();
    http_image_thread.join();
    http_video_thread.join();

    cout << "Main thread end" << endl;
    return 0;
}


